<?php
/**
 * Created by PhpStorm.
 * User: clcw908
 * Date: 2016/12/22
 * Time: 16:40
 */
namespace AuctionBack\Logic;

use AuctionBack\Model\CarDealerModel;
use AuctionBack\Logic\CarReportLogic;
use AuctionCore\CarResource\CarModel;
use AuctionBack\Logic\CarOwnerLogic;
use AuctionBack\Model\RefundModel;

class RefundCarTraceLogLogic
{

    protected $autoCheckFields = false;

    /**
     * 退车编号
     *
     * @var
     */
    protected $id;

    /**
     * 退车Model
     *
     * @var \Model|\Think\Model
     */
    protected $model;

    /**
     * RefundCar constructor.
     * @param $id
     */
    public function __construct($id)
    {
        $this->id = $id;
        $this->model = D('RefundCarTraceLog', 'Model');
    }

    /**
     * 添加退车信息
     *
     * @param $data 退车数据
     * @return mixed
     */
    public static function add($data)
    {
        $result = D('RefundCarTraceLog', 'Model')->add($data);
        return $result;
    }

    /**
     * 修改退车信息
     *
     * @param $data 退车数据
     * @return bool
     */
    public function save($data)
    {
        $id = $this->id;
        return D('RefundCarTraceLog', 'Model')->where(['id' => $id])->save($data);
    }


    /**
     * 根据退车编号，得到退车跟踪日志
     *
     * @param $refundId 退车编号
     * @return mixed
     */
    public static function getDataByRefundCarId($refundId)
    {
        return D('RefundCarTraceLog', 'Model')->where(['rc_id' => $refundId])->select();
    }

}